package com.offcn.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Swagger配置
 *
 * @author 秋林
 * @date 2022/10/13 15:23:48
 * EnableSwagger2  swagger开关
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {

    /**
     * 创建文档配置对象
     *
     * @return
     */
    @Bean
    public Docket docket(){
        return   new Docket(DocumentationType.SWAGGER_2).apiInfo(getApiInfo())
                .groupName("group1")
                .select()
                .build();
    }

    private ApiInfo getApiInfo() {
        return   new ApiInfoBuilder().title("广告微服务接口文档")
                .description("详情请参见:描述")
                .version("1.0")
                .termsOfServiceUrl("http://www.ujiuye.com")
                .build();
    }
}
